<?php
/**
 * Created by PhpStorm.
 * User: 69548
 * Date: 2018/7/23
 * Time: 17:50
 */

namespace app\api\controller;

use app\api\controller\Base;
use app\api\model\City as C;



class Index extends Base
{

    public function index(){
        //获取城市模型
        $c=new C();
        $index= $c->index();
        return json_encode($index);
    }

    public function city(){
        $shu=[];
        $c=new C();
        $city= $c->city();
        if ($city==true){
            $shu=[
                'code'=>0,
                'msg'=>'请求成功',
                'data'=>$city
            ];
        }else{
            $shu=[
                'code'=>1,
                'msg'=>'请求失败',
                'data'=>[]
            ];
        }

        echo json_encode($shu);die;
    }


    //小程序城市接口
    public function wxpindex(){
        $post = request()->post();

        //获取城市模型
        $c=new C();
        $index= $c->pindex($post);
        return json_encode($index);
    }


}



